package com.jqk.shoporder.feign.fallback;

import com.jqk.shoporder.bean.Product;
import com.jqk.shoporder.feign.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Author:jiangqikun
 * @Date:2022/3/2 14:31
 * 容错类要求必须实现被容错的接口,并为每个方法实现容错方案
 **/

@Component
@Slf4j
public class ProductServiceFallBack implements ProductService {
    @Override
    public Product findByPid(Integer pid) {
        Product product = new Product();
        product.setPid(-1);
        return product;
    }

    @Override
    public void reduceProduct(Integer pid, int num) {
        log.info("商品暂时没有库存，请稍后再试");
    }
}